package com.logic.modular.act.battle;

import com.comment.util.message.ResponseResult;
import com.logic.comment.util.JwtUtils;
import com.logic.modular.act.battle.vo.BattleVo;
import com.logic.modular.game.player.hero.service.PlayerHeroServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

@Api(tags = "pvp武将行为")
@Validated
@RestController
@AllArgsConstructor
@RequestMapping("/pvpHeroAct")
public class PvpHeroAction {
    @Resource
    private PlayerHeroServiceImpl playerHeroService;
    @ApiOperation("单武将补兵")
    @PostMapping("/buBingByWuJiang")
    public ResponseResult<?> buBingByWuJiang(
            @RequestHeader String token,
            @Valid @RequestBody BattleVo.PvpHeroVo.BuBingByWuJiang param
    ) {
        Long playerId = JwtUtils.getPlayerId(token);
        return ResponseResult.success(playerHeroService.buBing(
                playerId, param.getCoreHeroId(), param.getTroopsQuantity())
        );
    }

}
